<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <cpn2>
        </cpn2>

    </div>

    <script>
        //1、创建第一个组件
        const cpnC1 = Vue.extend({
            template: `<div>
            <h2>我是标题</h2>
            <p>我是内容哈哈哈</p>
        </div>`
        })

        //2、创建第二个组件构造器,作为父组件，在内部使用子组件cpn1
        const cpnC2 = Vue.extend({
            template: `
            <div>
            <h2>我是标题222</h2>
            <p>我是内容哈哈哈222</p>
            <cpn1></cpn1>
        </div>`,
            components: {
                cpn1: cpnC1
            }
        })



        const vm = new Vue({
            el: '#app',
            data: {
                message: '我是你爹!'
            },
            methods: {},
            components: {
                cpn2: cpnC2
            }
        });
    </script>
</body>

</html>